<%
    Dim objWord
    Set objWord = CreateObject("Word.Application")
    'makes the file visible ie opens Word
    'objWord.visible=True
    'this is to open an existing file
    'objWord.Documents.Open "c:\test.doc"
    'save as new file
    'objWord.ActiveDocument.SaveAs "c:\newtest.doc"
    'creates a new file and adds content
    objWord.Documents.Add.Content = "Que thal this code ws written by BOO. Use MSDN For more help"
    'Get the number of words in the document
    '     
    NumberOfWords = objWord.ActiveDocument.Words.count
    'How many spelling errors are there in the document?
    NumberOfErrors = objWord.ActiveDocument.SpellingErrors.Count
    'add footer page numbers
    objWord.ActiveDocument.Sections(1).Footers(1).PageNumbers.Add
    'change page settings
    objWord.ActiveDocument.Sections(1).PageSetup.LeftMargin = 30
    objWord.ActiveDocument.SaveAs "c:\newtest.doc"
	objWord.ActiveDocument.Close
    objWord.Quit 
    Set objWord = Nothing
    %>
<BODY>

    <TABLE>
    <TR>
    	<TD>Number of Spelling erros = <%=NumberOfErrors%></TD>
    </TR>
    <TR>
    	<TD>Number of Words In Doc = <%=NumberOfWords%></TD>
    </TR>
    </TABLE>

</BODY>
</HTML>
